<?php

namespace app\api\model;

use app\api\service\Api;
use think\Db;
use think\Request;

class ProductPlanNoRateModel extends Api
{
    protected static $instance;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);
    }

    public static function getInstance()
    {
        if (is_null(self::$instance))
        {
            self::$instance = new static();
        }
        return self::$instance;
    }

    /**
     * 删除记录
     */
    public function delete($where)
    {
        return Db::name('product_plan_no_rate')->where($where)->delete();
    }

    /**
     * 插入很多记录
     */
    public function insertAll($data)
    {
        return Db::name('product_plan_no_rate')->insertAll($data);
    }

    /**
     * 获取很多记录
     */
    public function select($where, $field = '*', $start = 0, $limit = 100000)
    {
        return Db::name('product_plan_no_rate')->where($where)->field($field)->limit($start, $limit)->select();
    }

    /**
     * 获取一个字段
     */
    public function value($where, $field = 'money')
    {
        return Db::name('product_plan_no_rate')->where($where)->value($field);
    }

    /**
     * 获取一列字段
     */
    public function column($where, $field = '*')
    {
        return Db::name('product_plan_no_rate')->where($where)->column($field, 'id');
    }
}